package C059.graph;

import java.lang.instrument.ClassDefinition;

/**
 * ClassName: Test
 * Package: C059.graph
 * Description:
 *
 * @Author BCXJ
 * @Create 2025/9/24 07:30
 * @Version 1.0
 * @Since 1.0
 */
public class Test {
    public static void main(String[] args) {
        int[][] edge = {{1,2,2}, {2,3,3}, {3,1,4}, {4,2,5}, {4,4,7}, {5,1,10}, {5,5,9}};
        // 邻接矩阵
        GraphInterface graph = new AdjacencyMatrix();
        graph.init(5);


        graph.build(edge);
        graph.print();

        // 邻接表
        graph = new AdjacencyList();
        graph.init(5);
        graph.build(edge);
        graph.print();

        // 前式链向星
        graph = new ChainForwardStar();
        graph.init(5, 7);
        graph.build(edge);
        graph.print();

    }
}
